package com.aspose.cells.a.d;

import com.aspose.cells.Color;

public class zex {
   static String[] a = new String[]{"courier", "courier new", "courier oblique", "courier new italic", "courier bold", "courier new bold", "courier bold oblique", "courier new bold italic", "helvetica", "arial", "helvetica oblique", "arial italic", "helvetica bold", "arial bold", "helvetica bold oblique", "arial bold italic", "times roman", "times new roman", "times italic", "times new roman italic", "times bold", "times new roman bold", "times bold italic", "times new roman bold italic", "symbol", "zapfdingbats"};
   private zdh b;
   private zew c;
   private boolean d;
   private boolean e;
   private com.aspose.cells.b.a.b.zo f;
   private com.aspose.cells.b.a.b.zo g;
   private String h;
   private float i = 0.0F;

   private zex() {
   }

   public zex(zdh var1, zew var2) {
      this.b = var1;
      this.c = var2;
   }

   public void a(zf var1) throws Exception {
      StringBuilder var2 = new StringBuilder(64);
      if (var1.d().f()) {
         this.b.i().a(this.c);
         this.b.i().c(var1.d().k().h() / 25.4F, this.c);
         var2.setLength(0);
         zfc.a(var1.e(), var2);
         var2.append(" RG");
         this.c.c(com.aspose.cells.b.a.zr.a(var2));
         var2.setLength(0);
         zfc.a(var1.l(), var2);
         var2.append(' ');
         zfc.a(var1.k() - var1.j().c() / 2.0F, var2);
         var2.append(" m");
         this.c.c(com.aspose.cells.b.a.zr.a(var2));
         var2.setLength(0);
         zfc.a(var1.l() + var1.j().b(), var2);
         var2.append(' ');
         zfc.a(var1.k() - var1.j().c() / 2.0F, var2);
         var2.append(" l");
         this.c.c(com.aspose.cells.b.a.zr.a(var2));
         this.c.c("S");
         this.b.i().b(this.c);
      }

      this.a();
      zav var3 = var1.d();
      boolean var4 = this.b.b().e();
      if (!var4 && zez.b(var1.h())) {
         var4 = false;
      }

      if (var3.j().z()) {
         var4 = false;
      }

      if (this.b.b().u()) {
         var4 = true;
      }

      zdw var5 = null;
      var5 = this.b.c().a(var3.a(), var3.c(), var4);
      if (this.b.h() != null) {
         var5.b(this.b.h().m());
      }

      this.i = var1.n();
      if (!var1.b && !var1.a) {
         this.c.c(" 0 Ts");
      }

      this.a(var5, var3.b());
      this.a(var5, var1);
      boolean var6 = var1.f() != null && !var1.f().isEmpty() || var5.d();
      float var7;
      if (!var6) {
         if (this.d || this.b.i().b().f() != var1.e() || this.b.i().b().j() != 0) {
            this.d();
         }

         this.a(0);
         this.b.i().a(var1.e(), false, this.c);
      } else {
         this.d();
         if (!var1.e().isEmpty()) {
            this.a(2);
            this.b.i().a(var1.e(), false, this.c);
         } else {
            this.a(1);
         }

         if (var5.d()) {
            var7 = var1.d().b() / 30.0F;
            var2.setLength(0);
            zfc.a(var7, var2);
            var2.append(" w");
            this.c.c(com.aspose.cells.b.a.zr.a(var2));
            Color var8 = !var1.e().isEmpty() ? var1.e() : var1.f();
            this.b.i().a(var8, true, this.c);
         } else {
            var2.setLength(0);
            zfc.a(0.5F, var2);
            var2.append(" w");
            this.c.c(com.aspose.cells.b.a.zr.a(var2));
            this.b.i().a(var1.f(), true, this.c);
         }
      }

      if (var1.b) {
         var7 = var1.d().k().h() * 0.1F;
         var2.setLength(0);
         var2.append('-');
         zfc.a(var7, var2);
         var2.append(" Ts");
         this.c.c(com.aspose.cells.b.a.zr.a(var2));
      }

      if (var1.a) {
         var7 = var1.d().k().h() * 0.6F;
         var2.setLength(0);
         zfc.a(var7, var2);
         var2.append(" Ts");
         this.c.c(com.aspose.cells.b.a.zr.a(var2));
      }

      this.a(var1, var5, var4);
      this.g.a(this.g.d() + var1.i().b());
      this.d = false;
      this.b();
   }

   public void a() throws Exception {
      this.c.c("BT");
      this.d = true;
      this.h = "Tj";
   }

   public void b() throws Exception {
      this.d();
      this.c.c("ET");
   }

   private void a(zdw var1, zf var2) throws Exception {
      if (!this.d && !var1.c() && !this.b.i().b().h().c()) {
         if (!com.aspose.cells.b.a.b.zo.a(var2.g(), this.g)) {
            this.d();
            float var3 = var2.g().d() - this.f.d();
            float var4 = var2.g().e() - this.f.e();
            StringBuilder var5;
            if (var4 == this.b.i().b().g()) {
               if (var2.g().d() == this.f.d()) {
                  this.h = "'";
               } else {
                  var5 = new StringBuilder(32);
                  zfc.a(var3, var5);
                  var5.append(' ');
                  zfc.a(-var4, var5);
                  var5.append(" Td");
                  this.c.c(com.aspose.cells.b.a.zr.a(var5));
               }
            } else if (var2.g().d() == this.f.d()) {
               this.b.i().a(var4, this.c);
               this.h = "'";
            } else {
               var5 = new StringBuilder(32);
               zfc.a(var3, var5);
               var5.append(' ');
               zfc.a(-var4, var5);
               var5.append(" TD");
               this.c.c(com.aspose.cells.b.a.zr.a(var5));
               this.b.i().b().a(var4);
            }

            this.f = new com.aspose.cells.b.a.b.zo(var2.g().d(), var2.g().e());
            this.g = new com.aspose.cells.b.a.b.zo(var2.g().d(), var2.g().e());
         }
      } else {
         this.d();
         this.b(var1, var2);
      }
   }

   private void a(int var1) throws Exception {
      this.d();
      this.b.i().a(var1, this.c);
      this.b.i().b(this.i, this.c);
   }

   private void a(zdw var1, float var2) throws Exception {
      this.d();
      this.b.i().a(var1, var2, this.c);
   }

   private void b(zdw var1, zf var2) throws Exception {
      float var3 = 1.0F;
      float var4 = 0.0F;
      float var5 = var1.c() ? 0.34906587F : 0.0F;
      float var6 = -1.0F;
      float var7 = var2.g().d();
      float var8 = var2.g().e();
      this.c.a(var3, var4, var5, var6, var7, var8, "Tm");
      this.f = new com.aspose.cells.b.a.b.zo(var2.g().d(), var2.g().e());
      this.g = new com.aspose.cells.b.a.b.zo(var2.g().d(), var2.g().e());
   }

   private void a(zf var1, zdw var2, boolean var3) throws Exception {
      this.c();
      if (var3) {
         this.a(var1, (zfb)var2);
      } else {
         this.a(var1, (zez)var2);
      }

   }

   private void c() throws Exception {
      if (!this.e) {
         this.c.a("(");
         this.e = true;
      }
   }

   private void d() throws Exception {
      if (this.e) {
         this.c.c(") " + this.h);
         this.h = "Tj";
         this.e = false;
      }
   }

   private void a(zf var1, zez var2) throws Exception {
      var2.a(var1.h());
      this.c.d(var1.h());
   }

   private void a(zf var1, zfb var2) throws Exception {
      byte[] var3 = var2.a(var1.h());
      this.c.a(var3);
   }
}
